// EMERGENT GAME TECHNOLOGIES PROPRIETARY INFORMATION
//
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Emergent Game Technologies and may not 
// be copied or disclosed except in accordance with the terms of that 
// agreement.
//
//      Copyright (c) 1996-2007 Emergent Game Technologies.
//      All Rights Reserved.
//
// Emergent Game Technologies, Chapel Hill, North Carolina 27517
// http://www.emergent.net

#ifndef CEGUIRENDERCLICK_H
#define CEGUIRENDERCLICK_H

#include <NiMain.h>
#include <NiInputSystem.h>

#pragma warning (disable:4530) // disable warning about not using exceptions
#include <CEGUI.h>
#include "CeguiGamebryoRenderer.h"

class CeguiRenderClick : public NiRenderClick
{
public:
    CeguiRenderClick(bool bActive);
	~CeguiRenderClick();

    // Functions for reporting statistics about the most recent frame.
    virtual unsigned int GetNumObjectsDrawn() const;
    virtual float GetCullTime() const;
    virtual float GetRenderTime() const;
	void ProcessInput();
protected:
    virtual void PerformRendering(unsigned int uiFrameID);

	// Rendering statistics.
    unsigned int m_uiNumObjectsDrawn;
    float m_fCullTime;
    float m_fRenderTime;

	// Cegui using gamebryo specific handle, conveniently already cast to
	// non-generic renderer type.
	CEGUIGamebryoRenderer* m_pkCEGUIRenderer;

	// Keyboard handler state and settings.
	unsigned char m_ucPreviouslyPressedKey;
	float m_fTimeSinceEmitKey;
	float m_fKeyRepeatDelay;
	float m_fKeyRepeatRate;

	// The Gamebryo keycodes are packed together into a contiguous block
	// of consecutive numbers. We must manually provide a mapping back to
	// real scancodes.
	void FillMapping();
	unsigned char m_aucNIIToDIMapping[NiInputKeyboard::KEY_TOTAL_COUNT];
};

#endif
